# Provide this find script to cmake.

# Locate VideoInput library which internally runs MediaFoundation
# This module defines
# VideoInput_LIBRARIES
# VideoInput_FOUND
# VideoInput_INCLUDE_DIRS, where to find the headers
# VideoInput_DIR corresponds to the environment variable VideoInput_DIR
#

set(VideoInput_DIR "$ENV{VideoInput_DIR}" CACHE PATH "Location of VideoInput")

MACRO(VideoInput_FIND headername)

    FIND_PATH(VideoInput_INCLUDE_DIR ${headername}
        PATHS
        ${VideoInput_DIR}/include
        $ENV{VideoInput_DIR}/include
        DOC "Location of VideoInput Headers"
    )

    FIND_LIBRARY(VideoInput_LIBRARY
		NAMES VideoInput
        PATHS
        ${VideoInput_DIR}/lib_static
        $ENV{VideoInput_DIR}/lib_static
        DOC "Location of VideoInput Libraries"
    )

    if(VideoInput_LIBRARY AND VideoInput_INCLUDE_DIR)
        SET(VideoInput_FOUND 1)
    endif(VideoInput_LIBRARY AND VideoInput_INCLUDE_DIR)

ENDMACRO(VideoInput_FIND)

MACRO(VideoInput_FIND_DEBUG_AND_RELEASE headername)

	FIND_PATH(VideoInput_INCLUDE_DIR ${headername}
        PATHS
        ${VideoInput_DIR}/include
        $ENV{VideoInput_DIR}/include
        DOC "Location of VideoInput Headers"
    )

    FIND_LIBRARY(VideoInput_LIBRARY_RELEASE
        NAMES VideoInput
        PATHS
        ${VideoInput_DIR}/lib
        $ENV{VideoInput_DIR}/lib
        DOC "Location of VideoInput Libraries"
    )
	
	FIND_LIBRARY(VideoInput_LIBRARY_DEBUG
        NAMES VideoInputd
        PATHS
        ${VideoInput_DIR}/lib
        $ENV{VideoInput_DIR}/lib
        DOC "Location of VideoInput Libraries"
    )

	set(VideoInput_LIBRARY
		debug ${VideoInput_LIBRARY_DEBUG}
		optimized ${VideoInput_LIBRARY_RELEASE}
	)

    if(VideoInput_LIBRARY AND VideoInput_INCLUDE_DIR)
        SET(VideoInput_FOUND 1)
    endif(VideoInput_LIBRARY AND VideoInput_INCLUDE_DIR)
ENDMACRO(VideoInput_FIND_DEBUG_AND_RELEASE)


if(WIN32)
	set(VideoInput_FOUND "NO")
	#VideoInput_FIND(VideoInput/include/videoInput.h)
	VideoInput_FIND_DEBUG_AND_RELEASE(VideoInput/include/videoInput.h)
	
	if(VideoInput_FOUND)
		
		message(STATUS "VideoInput found")
		
		set(VideoInput_FOUND "YES")
	   
		set(VideoInput_INCLUDE_DIRS
			${VideoInput_INCLUDE_DIR}
		)
		
		set(VideoInput_LIBRARIES
			${VideoInput_LIBRARY}
		)
	endif()
endif()